<template>
  <div class="cu-common-layout">
    <div class="cu-common-layout-center">
      <el-form @submit.native.prevent label-position="right">
        <el-row class="cu-common-search-box" :gutter="15">
          <el-col :span="6">
            <el-form-item label="校区品牌" prop="brand">
              <el-select v-model="query.brand" placeholder="">
                <el-option :key="item.id" :label="item.fullName" :value="item.enCode" v-for="item in brandOptions" />
              </el-select>
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="校区信息" prop="info">
              <el-input v-model="query.info" clearable :style="{ width: '100%' }" />
            </el-form-item>
          </el-col>
          <el-col :span="6">
            <el-form-item label="投资人信息" prop="contact">
              <el-input v-model="query.contact" clearable :style="{ width: '100%' }" />
            </el-form-item>
          </el-col>
          <template v-if="showAll">
            <el-col :span="6">
              <el-form-item label="营业执照主体">
                <el-input v-model="query.businessName" clearable />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="服务截止日期">
                <el-date-picker v-model="query.serviceEndDate" type="daterange" value-format="yyyy-MM-dd" format="yyyy-MM-dd" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="开业日期">
                <el-date-picker v-model="query.openDate" type="daterange" value-format="yyyy-MM-dd" format="yyyy-MM-dd" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="校区类型">
                <el-select v-model="query.type" placeholder="" clearable>
                  <el-option v-for="(item, index) in typeOptions" :key="item.id" :label="item.fullName" :value="item.enCode" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="运营阶段">
                <el-select v-model="query.level" placeholder="" clearable>
                  <el-option v-for="(item, index) in levelOptions" :key="item.id" :label="item.fullName" :value="item.enCode" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="校区区域">
                <custom-address v-model="query.area" :multiple="true" />
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="校区状态">
                <el-select v-model="query.status" placeholder="" clearable>
                  <el-option v-for="(item, index) in statusOptions" :key="item.id" :label="item.fullName" :value="item.enCode" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="参保状态">
                <el-select v-model="query.inurance" placeholder="请选择参保状态" filterable clearable required :style="{ width: '100%' }">
                  <el-option :key="item.enCode" :label="item.fullName" :value="item.enCode" v-for="item in inuranceOptions" />
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="保险到期日">
                <el-date-picker v-model="query.inuranceDate" type="daterange" value-format="yyyy-MM-dd" format="yyyy-MM-dd" start-placeholder="开始日期" end-placeholder="结束日期"></el-date-picker>
              </el-form-item>
            </el-col>
          </template>
          <el-col :span="6">
            <el-form-item>
              <el-button type="primary" icon="el-icon-search" @click="search()" native-type="submit">查询</el-button>
              <el-button icon="el-icon-refresh-right" @click="reset()">重置</el-button>
              <el-button type="text" icon="el-icon-arrow-down" @click="showAll = true" v-if="!showAll">展开</el-button>
              <el-button type="text" icon="el-icon-arrow-up" @click="showAll = false" v-else>收起</el-button>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div class="cu-common-layout-main cu-flex-main">
        <div class="cu-common-head">
          <div style="display: flex;align-items: center">
            <el-button type="primary" icon="el-icon-plus" @click="addOrUpdateHandle()">批量确认</el-button>
            <el-input v-model="query.enCode" clearable :style="{ width: '100%', marginLeft: '20px' }" placeholder="校区编码">
              <el-button slot="append" icon="el-icon-search" @click="search()"></el-button>
            </el-input>
          </div>
          <div class="cu-common-head-right">
            <el-tooltip effect="dark" content="刷新" placement="top">
              <el-link icon="icon-ym icon-ym-Refresh cu-common-head-icon" :underline="false" @click="reset()" />
            </el-tooltip>
            <screenfull isContainer />
          </div>
        </div>
        <custom-table v-loading="listLoading" :data="list" has-c @selection-change="handleSelectionChange">
          <el-table-column prop="brand" label="校区品牌" align="center" width="80">
            <template slot-scope="scope">
              {{ scope.row.brand | dynamicCodeText(brandOptions) }}
            </template>
          </el-table-column>
          <el-table-column prop="code" label="校区编码" align="center" width="80" />
          <el-table-column prop="fullName" label="校区全称" align="left" width="200" show-overflow-tooltip />
          <el-table-column prop="shortName" label="校区简称" align="left" width="180" show-overflow-tooltip />
          <!-- <el-table-column prop="status" label="移交状态" align="left"  width="180" show-overflow-tooltip /> -->
          <el-table-column prop="investors" label="投资人" align="left" width="140" show-overflow-tooltip>
            <template slot-scope="scope">
              {{ formattedInfo(scope.row.investors) }}
            </template>
          </el-table-column>
          <el-table-column prop="fullAddress" label="校区地址" align="left" width="300" show-overflow-tooltip />
          <el-table-column prop="telephone" label="固定电话" align="center" width="100" show-overflow-tooltip />
          <el-table-column prop="email" label="校区邮箱" align="left" width="150" show-overflow-tooltip />
          <el-table-column prop="siteArea" label="场地面积" align="left" width="80" />
          <el-table-column prop="manager" label="负责人" align="left" width="80" />
          <el-table-column prop="managerMobile" label="联系电话" align="left" width="120" show-overflow-tooltip />
          <el-table-column prop="wechat" label="微信" align="left" width="120" show-overflow-tooltip />
          <el-table-column prop="type" label="校区类型" align="center" width="80">
            <template slot-scope="scope">
              {{ scope.row.type | dynamicCodeText(typeOptions) }}
            </template>
          </el-table-column>
          <el-table-column prop="renewal" label="续约费" align="left" width="80"></el-table-column>
          <el-table-column prop="deposit" label="保证金" align="left" width="80"></el-table-column>
          <el-table-column prop="status" label="状态" align="center" width="80">
            <template slot-scope="scope">
              <el-tag size="mini" v-if="scope.row.status == 'preparation'" type="" effect="dark">
                筹备
              </el-tag>
              <el-tag size="mini" v-if="scope.row.status == 'normal'" type="success" effect="dark">
                正常
              </el-tag>
              <el-tag size="mini" v-if="scope.row.status == 'expires'" type="info" effect="dark">
                待续费
              </el-tag>
              <el-tag size="mini" v-else-if="scope.row.status == 'suspended'" type="warning" effect="dark">
                暂停
              </el-tag>
              <el-tag size="mini" v-else-if="scope.row.status == 'close'" type="danger" effect="dark">
                闭校
              </el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="level" label="运营阶段" align="left" width="80">
            <template slot-scope="scope">
              {{ scope.row.level | dynamicCodeText(levelOptions) }}
            </template>
          </el-table-column>
          <el-table-column prop="openDate" label="开业日期" align="center" :formatter="custom.tableDateFormat" width="100" />
          <el-table-column prop="startDate" label="服务开始日期" align="center" :formatter="custom.tableDateFormat" width="100" />
          <el-table-column prop="endDate" label="服务结束日期" align="center" :formatter="custom.tableDateFormat" width="100" />
          <el-table-column prop="businessName" label="营业执照主体" align="left" width="200" show-overflow-tooltip />
        </custom-table>
        <pagination :total="total" :page.sync="listQuery.currentPage" :limit.sync="listQuery.pageSize" @pagination="initData" />
      </div>
    </div>
  </div>
</template>
<script>
export { default } from './index.js'
</script>
